package com.im.handler;

import com.im.handler.CustomerHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;
import io.netty.handler.stream.ChunkedWriteHandler;

public class ServerInitHandler extends ChannelInitializer<SocketChannel> {


  @Override
  protected void initChannel(SocketChannel socketChannel) throws Exception {
   ChannelPipeline pipeline = socketChannel.pipeline();
   //解码器
   pipeline.addLast(new HttpServerCodec());
   //自定义处理类
   pipeline.addLast("customerHander",new CustomerHandler());
   //为大数据传输提供支持
   pipeline.addLast(new ChunkedWriteHandler());


  }
}
